var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(c, b, a) {
    if (cm.isQuestActive(64764)) {
        action1(c, b, a)
    } else {
        if (cm.isQuestFinished(64771) && cm.getNumberFromQuestInfo(64764, "talk") == 0) {
            action2(c, b, a)
        } else {
            action0(c, b, a)
        }
    }
}

function action1(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.sendNormalTalk_Bottom("我们的第一次冒险开始！去地下1层看看吧？", 36, 9401029, false, true)
        } else {
            if (status === a++) {
                cm.askMenu("嘿，队长。你在哪一层下啊？\r\n\r\n#b#e<进入深渊>#k#n\r\n#L1# 地下1层：光明之帘#l", 4, 9401058)
            } else {
                cm.warp(867147010, 0, false);
                cm.dispose()
            }
        }
    }
}

function action2(f, d, c) {
    if (status == 0 && f == 0) {
        cm.dispose();
        return
    }(f == 1) ? status++ : status--;
    selectionLog[status] = c;
    var b = -1;
    if (status <= b++) {
        cm.dispose()
    } else {
        if (status === b++) {
            cm.sendNormalTalk_Bottom("你是不是想到要探险，从凌晨开始就合不上眼了呢？今天又会有什么样的事情在等着我们呢，好激动呀！", 36, 9401029, false, true)
        } else {
            if (status === b++) {
                cm.sendNormalTalk_Bottom("今天也请你多多关照，队长！", 36, 9401029, true, true)
            } else {
                if (status === b++) {
                    var e = "嘿，队长。你在哪儿下啊？\r\n\r\n#b#e<进入深渊>#k#n\r\n#L1# 地下1层：光明之帘#l\r\n#L2# 地下2层：薄暮#l\r\n#L3# 地下3层：坚固的大地#l\r\n#L4# 地下4层：宁静之波#l\r\n#L5# 地下5层：绿色飞流#l";
                    for (var b = 0; b < cm.getNumberFromQuestInfo(64753, "rank"); b++) {
                        e += "\r\n#L" + (6 + b) + "# #m" + (867147600 + b * 100) + "##l"
                    }
                    cm.askMenu(e, 4, 9401058)
                } else {
                    cm.dispose();
                    cm.setNumberForQuestInfo(64789, "map", c);
                    var a = cm.getEventManager("深渊远征队");
                    a.startInstance(cm.getPlayer())
                }
            }
        }
    }
}

function action0(f, d, c) {
    if (status == 0 && f == 0) {
        cm.dispose();
        return
    }(f == 1) ? status++ : status--;
    selectionLog[status] = c;
    var b = -1;
    if (status <= b++) {
        cm.dispose()
    } else {
        if (status === b++) {
            var e = "嘿，队长。你在哪儿下啊？\r\n\r\n#b#e<进入深渊>#k#n\r\n#L1# 地下1层：光明之帘#l\r\n#L2# 地下2层：薄暮#l\r\n#L3# 地下3层：坚固的大地#l\r\n#L4# 地下4层：宁静之波#l\r\n#L5# 地下5层：绿色飞流#l";
            for (var b = 0; b < cm.getNumberFromQuestInfo(64753, "rank"); b++) {
                e += "\r\n#L" + (6 + b) + "# #m" + (867147600 + b * 100) + "##l"
            }
            cm.askMenu(e, 4, 9401058)
        } else {
            cm.dispose();
            cm.setNumberForQuestInfo(64789, "map", c);
            var a = cm.getEventManager("深渊远征队");
            a.startInstance(cm.getPlayer())
        }
    }
};